home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 30
/
Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso
/
Aminet
/
util
/
cli
/
linkdir_source.lha
/
linkdir2.asm
< prev
Wrap
Assembly Source File
|
1996-06-29
|
5KB
|
284 lines
_execbase equ 4
openlib equ -552
closelib equ -414
allocmem equ -198
freemem equ -210
lock equ -84
unlock equ -90
examine equ -102
exnext equ -108
open equ -30
close equ -36
read equ -42
write equ -48
delay equ -198
move.l a0,caddress ;save commandline
move.l d0,clength
movem.l a0-a6/d0-d7,-(sp)
move.l _execbase,a6 ;open doslib
moveq #0,d0
move.l #dosname,a1
jsr openlib(a6)
move.l d0,dosbase
beq end
move.l #200,d0 ;alloc mem for dirname
moveq #0,d1
jsr allocmem(a6)
move.l d0,dirname
beq closel
move.l #200,d0 ;alloc mem for linkedline (19+filename)
moveq #0,d1
jsr allocmem(a6)
move.l d0,linkedline
beq freeram
move.l #260,d0 ;alloc mem for fileinfoblock
moveq #0,d1
jsr allocmem(a6)
move.l d0,fileinfoblock
beq freeram1
move.l dosbase,a6
move.l #1005,d2 ;open messagewindow
move.l #messagewindow,d1
jsr open(a6)
move.l d0,mwhandle
beq freeram2
move.l mwhandle,d1 ;write welcome
move.l #welcome,d2
move.l #welle,d3
jsr write(a6)
move.l caddress,a0
move.l dirname,a1
copyloop:
move.b (a0),d0
cmp.b #",",d0
beq loopend
cmp.b #10,d0
beq enodir
move.b (a0)+,(a1)+
bra copyloop
loopend:
move.b #0,(a1)
move.l #linkfilename,a1
add.l #1,a0
move.l #29,d0
copylinkfilename:
move.b (a0),d1
cmp.b #10,d1
beq clfnend
move.b (a0)+,(a1)+
dbra d0,copylinkfilename
clfnend:
cmp.l #29,d0
beq standardlfn
back:
move.b #0,(a1)
move.l #linkfilename,d1
move.l #1004,d2
; jsr open(a6)
; move.l d0,lfhandle
beq elinkfile
lockdir:
move.l dirname,d1
move.l #1005,d2
jsr lock(a6)
move.l d0,dirlock
beq elockdir
examinedir:
move.l dirlock,d1
move.l fileinfoblock,d2
jsr examine(a6)
examinenext:
move.l dirlock,d1
move.l fileinfoblock,d2
jsr exnext(a6)
cmp.l #0,d0
beq writefile
move.l fileinfoblock,a0
add.l #8,a0
move.l #29,d0
move.l #filename,a1
filenamecopy:
move.b (a0)+,(a1)+
dbeq d0,filenamecopy
show:
move.l mwhandle,d1
move.l #filename,d2
move.l #30,d3
jsr write(a6)
move.l mwhandle,d1
move.l #nextt,d2
move.l #nexttl,d3
jsr write(a6)
move.l #31,d0
move.l #filename,a0
clearfilename:
move.b #0,(a0)+
dbra d0,clearfilename
bra examinenext
writefile:
move.l mwhandle,d1
move.l #linkfilename,d2
move.l #30,d3
jsr write(a6)
exit:
btst #6,$bfe001
bne exit
move.l mwhandle,d1 ;put exit message
move.l #goodby,d2
move.l #goodbyl,d3
jsr write(a6)
unlockdir:
move.l dirlock,d1
jsr unlock(a6)
closemw:
move.l #50,d1
jsr delay(a6)
move.l mwhandle,d1 ;close messagewindow
jsr close(a6)
freeram2:
move.l _execbase,a6
move.l fileinfoblock,a1
move.l #260,d0
jsr freemem(a6)
freeram1:
move.l _execbase,a6
move.l linkedline,a1
move.l #200,d0
jsr freemem(a6)
freeram:
move.l _execbase,a6
move.l dirname,a1
move.l #200,d0
jsr freemem(a6)
closel:
move.l dosbase,a1
jsr closelib(a6)
end:
movem.l (sp)+,a0-a6/d0-d7
rts
standardlfn:
move.l #"inde",(a1)+
move.l #"x.ht",(a1)+
move.w #"ml",(a1)+
bra back
elockdir:
move.l mwhandle,d1
move.l #etlockdir,d2
move.l #etllockdir,d3
jsr write(a6)
bra closemw
enodir:
move.l mwhandle,d1
move.l #etnodir,d2
move.l #etlnodir,d3
jsr write(a6)
bra closemw
elinkfile:
move.l mwhandle,d1
move.l #etlinkfile,d2
move.l #etllinkfile,d3
jsr write(a6)
bra closemw
dosname:
dc.b "dos.library",0
cnop 0,4
dosbase:
dc.l 0
clength:
dc.l 0
caddress:
dc.l 0
dirlock:
dc.l 0
fileinfoblock:
dc.l 0
filehandle:
dc.l 0
filerror:
dc.b "Error on diskaccess !",13,10,0
filerrorl equ *-filerror
cnop 0,4
welcome:
dc.b "Welcome to LinkDir... !",13,10,10,0
welle equ *-welcome
cnop 0,4
messagewindow:
dc.b "RAW:30/50/370/390/"," ",126,"LinkDir",126," .................. June 1996 © by Greg McCoy",0
cnop 0,4
mwhandle:
dc.l 0
goodby:
dc.b "Thank you for pressing the self-destruct button... !",0
goodbyl equ *-goodby
cnop 0,4
etlockdir:
dc.b "Error locking directory !",13,10,0
etllockdir equ *-etlockdir
cnop 0,4
etnodir:
dc.b "Error: unspecified directory or comma missing !",13,10,0
etlnodir equ *-etnodir
cnop 0,4
etlinkfile:
dc.b "Error creating linkfile !",13,10,0
etllinkfile equ *-etlinkfile
cnop 0,4
startblock:
dc.b "<html>",13,10,"<head>",13,10,"<title>",13,10,"Linked with LinkDir © June 1996 by GregMcCoy",13,10,"</title>",13,10,"</head>",13,10,"<Body><hr>Simply click on linked files... Linked with LinkDir © Greg McCoy<hr><br><br><br>,13,10"
sbl equ *-startblock
cnop 0,4
endblock:
dc.b "</body>",13,10,"</html>",0
ebl equ *-endblock
cnop 0,4
linkedline:
dc.l 0
lllength:
dc.l 0
lineblocka:
dc.b "<A HREF="
lbal equ *-lineblocka
cnop 0,4
lineblockb:
dc.b "</A><BR>",13,10
lbbl equ *-lineblockb
cnop 0,4
bracket:
dc.b ">"
cnop 0,4
filename:
ds.b 32
dirname:
dc.l 0
nextt:
dc.b " ...",13,10,0
nexttl equ *-nextt
cnop 0,4
linkfilename:
ds.b 32
lfhandle:
dc.l 0